package com.jfinal.ext.ueditor.config;

/**
 * @author Timor
 * @version 1.0
 * @date 2023/01/04 20:36:41
 */
public class FileUploadConfig extends ActionConfig implements IUploadConfig {
    public static final String DEFAULT_NAME = "unknown";
    private String name = DEFAULT_NAME;
    private String fieldName = null;
    private String pathFormat = null;
    private int maxSize = 0;

    @Override
    public String getName() {
        return name;
    }

    public void setName(String name) {
        if (DEFAULT_NAME.equals(this.name)) {
            this.name = name;
        }
    }

    @Override
    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    @Override
    public String getPathFormat() {
        return pathFormat;
    }

    public void setPathFormat(String pathFormat) {
        this.pathFormat = pathFormat;
    }

    @Override
    public int getMaxSize() {
        return maxSize;
    }

    public void setMaxSize(int maxSize) {
        if (maxSize > -1) {
            this.maxSize = maxSize;
        }
    }
}
